<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html">
	<meta charset="utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<title></title>
</head>
<body erke-hide>
</body>
<script>
/**
 * @param {number} x
 * @return {number}
 */
var reverse = function(x) {
	    	x=x.toString().split('').reverse();
		    //console.log(x[x.length-1]=="-");
		    if(x[x.length-1]=="-"){
		        for(var i=x.length-1;i>0;i--){
		            x[i]=x[i-1];
		        };
		        x[0]="-";
		    }; 
		    x=parseInt(x.join(''));
		    console.log(x);
            if(x>2147483647||x<-2147483648){
                return 0;
            }else{
                return x;
            };
		    
	    };
</script>
</html>
